package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;


import com.ysd.entity.Design;

import com.ysd.util.DBManage;


public class DesignDao {
	public static ArrayList<Design> getAll() {
		ArrayList<Design> ls=new ArrayList<Design>();
		
		try {
			Connection conn= DBManage.getConn();
			Statement stam=conn.createStatement();
			ResultSet rs=stam.executeQuery("select id,imgUrl,desName,jobs FROM Design limit 0,4");
			while(rs.next()) {
				 Design u=new Design(rs.getInt("id"), rs.getString("imgUrl"),rs.getString("desName"),rs.getString("jobs"));
					ls.add(u);
			}
			DBManage.colseAll(rs, stam, conn);	
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return ls;
	}
}
